package net.tycmc.cty.ctyms.web.Action;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Map;

import com.tycmc.functions.util.MapGetter;

import net.tycmc.cty.ctyms.timejob.iems.service.MtnForstNewConn;
import net.tycmc.cty.ctyms.web.Service.MaintForstCastService;

/**
 * 保养预测
 * @author songxiaohu
 *
 */
public class MaintForstCastAction extends BaseActionS2 {
	private MtnForstNewConn mtnForstNewConn;
	private MaintForstCastService maintfcs;
	public MaintForstCastService getMaintfcs() {
		return maintfcs;
	}

	public void setMaintfcs(MaintForstCastService maintfcs) {
		this.maintfcs = maintfcs;
	}

	
	public MtnForstNewConn getMtnForstNewConn() {
		return mtnForstNewConn;
	}

	public void setMtnForstNewConn(MtnForstNewConn mtnForstNewConn) {
		this.mtnForstNewConn = mtnForstNewConn;
	}

	/**
	 * 保养预测初始化
	 * @return
	 */
	public String getDataInit(){	
		//查询今日已经统计完成的数据条数
		Map<String,Object> map=maintfcs.getMaintForstCastDataOfToday();
		request.setAttribute("num",MapGetter.getString(map,"cnt"));
		request.setAttribute("date",MapGetter.getString(map,"Newdate"));
		return "MaintForstCast";
	}
	/**
	 * 保养预测重新统计
	 * @return
	 * @throws IOException 
	 */
	public String reloadMaintForstCast() throws IOException{
		mtnForstNewConn.mtnForstNewShowTime();
		//查询今日已经统计完成的数据条数
		Map<String,Object> map=maintfcs.getMaintForstCastDataOfToday();
		PrintWriter out=response.getWriter();
		out.print("{'total':"+MapGetter.getString(map,"cnt")+"}");
		return null;
	}
}
